package com.base.grammardemo;

class Person{
	String name;
	private static String country="北京";
	
	public static String getCountry() {
		return country;
	}

	public static void setCountry(String country) {
		Person.country = country;
	}
	
	public Person(String name){
		this.name = name;
	}
	
	public void tell(){
		System.out.println("姓名:"+name+"出生地"+country);
	}
}

public class StaticDemo01 {
	public static void main(String[] args) {
		Person.setCountry("上海"); //静态的属性和方法都要通过类名儿来调用
		
		Person p1=new Person("张三");
		//p1.country="上海";
		//Person.country = "上海"; //静态属性最好是通过类名来调用
        p1.tell();
        Person p2=new Person("李四");
        p2.tell();
        Person p3=new Person("王五");
        p3.tell();
	}
}